<?php

/*
 * File name : show_company_profile.php
* Description : Connects to the database and displays the profile of the company.
* Created By : Abhiraj Chauhan
*/

include_once "basePage.php";

class showCompanyProfile extends basePage{
	public function show_profile(){
		$company_name = $_POST['company_name'];
		$company_zip = $_POST['company_zip'];
		
		$con=mysql_connect("localhost", "pa_user","secret_password");
		if (!$con)
			die("Could Not Connect:".mysql_error() );
		
		mysql_select_db("tgs_gm_reservation", $con);
		
		$result = mysql_query("SELECT * FROM tgs_gm_reservation.tblcompany where CompanyName = '{$company_name}' AND CompanyZip = '{$company_zip}'");
		
		//echo $result;
		
		if (!($result)){
			echo "<h2>Company Does Not Exist. Please Sign Up</h2><br />";
			echo "<a href = 'signupcompany.php'>Sign Up - Company</a>";
			echo "<a href = 'company.php'>Invite your Company</a>";
		}
		else{
			while($row = mysql_fetch_array($result))
			{
				echo <<<SHOW
				<table>
				<tr>
				<td>Company Name</td>
				<td>{$row['CompanyName']}</td>
				</tr>
				<tr>
				<td>Company Address</td>
				<td>{$row['CompanyAddress']}</td>
				</tr>
				<tr>
				<td>Company AddressLine</td>
				<td>{$row['CompanyAddressLine']}</td>
				</tr>
				<tr>
				<td>Company City</td>
				<td>{$row['CompanyCity']}</td>
				</tr>
				<tr>
				<td>Company Zip</td>
				<td>{$row['CompanyZip']}</td>
				</tr>
				<tr>
				<td>Company Website</td>
				<td>{$row['CompanyWebsite']}</td>
				</tr>
				<tr>
				<td>Company ContactFName</td>
				<td>{$row['CompanyContactFName']}</td>
				</tr>
				<tr>
				<td>Company ContactLName</td>
				<td>{$row['CompanyContactLName']}</td>
				</tr>
				<tr>
				<td>Company ContactTitle</td>
				<td>{$row['CompanyContactTitle']}</td>
				</tr>
				<tr>
				<td>Company ContactPhone</td>
				<td>{$row['CompanyContactPhone']}</td>
				</tr>
				<tr>
				<td>Company ContactEmail</td>
				<td>{$row['CompanyContactEmail']}</td>
				</tr>
				</table>
SHOW;
				break;
			}
		}
	}
}

$page = new showCompanyProfile();
$page->header();
$page-> include_transalte();
$page-> top_menu_company();
$page -> show_profile();
$page -> footer();

?>